1. Field of the Invention
This invention relates in general to the field of floating point instruction execution in computers, and more specifically to an improved apparatus and method for recording exception pointer data associated with a floating point instruction.
2. Description of the Related Art
Software programs that execute on a microprocessor consist of macro instructions, which together direct the microprocessor to perform a function. Each macro instruction directs the microprocessor to perform a specific operation, which is part of the function, such as loading data from memory, storing data in a register, or adding the contents of two registers.
A macro instruction may prescribe a simple operation, like moving the contents of one register location to another register location. In contrast, a different macro instruction may prescribe a complex operation, such as adding a floating point number to another floating point number. Compared to the manipulation of integer data, the manipulation of floating point data by the microprocessor is complex and time consuming. Because of this, typical microprocessors employ a dedicated floating point unit to improve the speed and efficiency of floating point calculations.
Within an x86-compatible microprocessor, a floating point macro instruction is often decoded into a sequence of floating point micro instructions that direct the microprocessor to execute a floating point operation. The sequence of floating point micro instructions proceeds through the integer unit of the microprocessor and is passed to the floating point unit. The floating point unit executes the sequence of floating point micro instructions and provides a result of the floating point operation.
In many instances, however, the floating point unit cannot produce the result of the floating point operation. Consequently, the floating point unit generates an exception code to inform the integer unit. An exception handler, part of the software program, processes the exception code.
For the exception handler to process the exception code, the floating point macro instruction that caused the exception condition must be identified. In an x86-compatible microprocessor, the responsible floating point macro instruction is identified via a floating point macro instruction error pointer. The floating point macro instruction error pointer documents the operation specified by the floating point macro instruction, the memory location from where it was retrieved, and the memory location of any associated floating point data.
Each time a floating point macro instruction is decoded, and a sequence of floating point micro instructions is passed to the floating point unit, a floating point macro instruction error pointer is stored. If a floating point exception results, then the floating point macro instruction error pointer is thereby available for use by an exception handler.
Typical microprocessors employ one of two general techniques to store the floating point macro instruction error pointer: A first technique dedicates hardware for the purpose of retrieving and storing the floating point macro instruction error pointer. A second technique makes use of unique micro instructions to store specified error pointer elements in associated registers in the register set.
The first technique requires extra hardware above that required to implement the basic functions of the microprocessor. Along with this hardware comes the requirement for extra power. Dedicated hardware also adds complexity to the design. Both of these attributes result in a cost addition to the microprocessor. Because of these reasons, one skilled in the art holds that the dedicated hardware in a microprocessor is undesirable.
The second technique dedicates time to store elements of the error pointer. After a floating point macro instruction is decoded into a floating point micro instruction sequence, the microprocessor adds micro instructions to this sequence. The added micro instructions direct the microprocessor to store elements of the error pointer. Storage of the entire error pointer requires several cycles of the microprocessor clock. Typically, one clock cycle is required to store each error pointer element. Consequently, utilizing the second technique increases execution time for the floating point macro instruction over that required to perform the specified floating point operation. Therefore, one skilled in the art appreciates that the second technique exhibits another problem, because it causes an increase in execution time for a given floating point macro instruction.
Since floating point macro instructions are extensively used in software programs, the consequent time delays incurred to record the floating point error pointer, as described above, can negatively impact the time required to execute a program.
Therefore, what is needed is an apparatus and method hat allow a microprocessor to record a floating point macro instruction error pointer faster than has heretofore been provided. In addition, what is needed is a microprocessor that does not require dedicated hardware to record a floating point macro instruction error pointer.